home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 22 / AACD 22.iso / AACD / Programming / RxMUI / Examples / nlisttree.rexx < prev    next >
Encoding:
OS/2 REXX Batch file  |  2001-05-24  |  4.0 KB  |  133 lines

  1. /**/
  2.  
  3. signal on halt
  4. signal on break_c
  5.  
  6. call Init
  7. call CreateApp
  8. call HandleApp
  9. /* nevre reached */
  10.  
  11. /***********************************************************************/
  12. Init: procedure
  13.     l="rmh.library";if ~show("L",l) then;if ~addlib(l,0,-30) then exit
  14.     if AddLibrary("rxmui.library")~=0 then exit
  15.     call RxMUIOpt("DebugMode ShowErr")
  16.     return
  17. /***********************************************************************/
  18. HandleApp: procedure
  19.  
  20.     ctrl_c=2**12
  21.     do forever
  22.  
  23.         call NewHandle("app","h",ctrl_c)
  24.         if and(h.signals,ctrl_c)>0 then exit
  25.         select
  26.             when h.event="QUIT" then exit
  27.             when h.event="DROPEVENT" then call dropFun(h.from,h.to)
  28.             otherwise interpret h.event
  29.         end
  30.     end
  31.     /* never reached */
  32. /***********************************************************************/
  33. CreateApp: procedure
  34.     app.Title="NListtree example"
  35.     app.Version="$VER: NListtree example 2.0 (14.12.00)"
  36.     app.Copyright="©2000, alfie"
  37.     app.Author="alfie"
  38.     app.Description="NListtree example"
  39.     app.Base="NLISTTREE"
  40.     app.SubWindow="win"
  41.      win.ID="MWIN"
  42.      win.Title="NListtree example"
  43.      win.Contents="mgroup"
  44.  
  45.       mgroup.0="bg"
  46.        bg.Class="group"
  47.        bg.Columns=2
  48.        bg.SameSize=1
  49.         bg.0=Button("openall","Open _all")
  50.         bg.1=Button("openactive","Open a_ctive")
  51.         bg.2=Button("closeall","Close a_ll")
  52.         bg.3=Button("claseactive","Close ac_tive")
  53.  
  54.       mgroup.1="lv"
  55.        lv.Class="NListview"
  56.        lv.List="list"
  57.         list.Class="NListtree"
  58.         list.Frame="InputList"
  59.         list.Format="BAR,"
  60.         list.Title="Name|Phone"
  61.         list.NLTAutoVisible="expand"
  62.         list.DragDropSort=1
  63.  
  64.          list.0="Friends"; list.0.Flags="Close"; list.0.List="fr"
  65.           fr.0="Jhon|555876"; fr.0.name="Jhon"
  66.           fr.1.type="Tree"; fr.1.Flags="Close"; fr.1="Uni|555643"; fr.1.list="uni"
  67.            uni.0="Mary|555987"
  68.            uni.1="Carol|555432"
  69.            uni.2.Flags="list"; uni.2="Frank|555432"
  70.           fr.2="Angel|5554231"
  71.          list.1="St. Clara Comp shop|555543241"
  72.  
  73.       mgroup.2="acg"
  74.        acg.class="group"
  75.        acg.horiz=1
  76.         aname.format="right"
  77.         acg.0=Label(ParseText("%bActiveName:"))
  78.         acg.1=string("aname")
  79.         acg.2=Label(ParseText("%bActiveID:"))
  80.         acg.3="aid"
  81.          aid.class="slider"
  82.          aid.min=0
  83.          aid.max=16
  84.  
  85.       mgroup.3="ddg"
  86.        ddg.class="group"
  87.        ddg.horiz=1
  88.         ddg.0=Label(ParseText("%b D&D here!"))
  89.         ddg.1=text("text")
  90.  
  91.     res = NewObj("APPLICATION","APP")
  92.     if res>0 then exit
  93.  
  94.     call dandd(list,"text")
  95.  
  96.     call set("win","open",1)
  97.     call getattr("win","open","o")
  98.     if o=0 then exit
  99.  
  100.     call Notify("win","closerequest",1,"app","returnid","quit")
  101.  
  102.     call Notify("list","activename","everytime","aname","set","contents","triggervalue")
  103.     call Notify("list","activeid","everytime","aid","set","value","triggervalue")
  104.     call Notify("list","activeid","everytime","app","return","say h.activeid","triggerattr")
  105.  
  106.     call Notify("openall","pressed",0,"list","open","root","all")
  107.     call Notify("openactive","pressed",0,"list","open","active","active")
  108.  
  109.     call Notify("closeall","pressed",0,"list","close","root","all")
  110.     call Notify("claseactive","pressed",0,"list","close","active","all")
  111.  
  112.     call Notify("aname","newcontents","everytime","list","set","activename","triggervalue")
  113.     call Notify("aid","value","everytime","list","set","activeid","triggervalue")
  114.  
  115.     return
  116. /***********************************************************************/
  117. halt:
  118. break_c:
  119.     exit
  120. /**************************************************************************/
  121. DropFun: procedure
  122. parse arg from,to
  123.     call DoMethod("list","getentry","a","active")
  124.     parse var a name "|" phone
  125.     if phone="" then do
  126.         call DoMethod("win","DisplayBeep")
  127.         return
  128.     end
  129.     c=ParseText("%bName:%n" "%i"name"%n" "%bPhone:%n" "%i"phone"%n")
  130.     call set("text","contents",c)
  131.     return
  132. /**************************************************************************/
  133.